// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "MotionSubtitlesLayerBase.h"
#include "MotionSubtitlesSpriteLayer.generated.h"

/**
 * 
 */
UCLASS( ClassGroup=(MotionSubtitles), meta=(BlueprintSpawnableComponent) )
class MOTIONSUBTITLES_API UMotionSubtitlesSpriteLayer : public UMotionSubtitlesLayerBase
{
	GENERATED_BODY()

public:
	
	FVector OriginLocation;

public:	
	// Sets default values for this component's properties
	UMotionSubtitlesSpriteLayer();

protected:
	virtual void Init(const FUint32Vector2& ViewSize) override;
	virtual void Show(const FSubtitleParams& Params) override;
	virtual void Hide() override;
	virtual void Exit() override;

public:
	virtual void DoScale(const EAnimTarget AnimTarget, const int32 ElementId, const float Value) override;
	virtual void DoTranslate(const EAnimTarget AnimTarget, const int32 ElementId,const FVector Value) override;
	virtual void DoFade(const EAnimTarget AnimTarget, const int32 ElementId,const float Value) override;
	virtual void DoDissolve(const EAnimTarget AnimTarget, const int32 ElementId, const float Value) override;
	virtual void CaptureStatus() override;
	virtual int32 ElementCount() override;
protected:
	UPROPERTY(EditDefaultsOnly,Category=MotionSubtitles)
	TObjectPtr<UTexture2D> Sprite;

	UPROPERTY(VisibleInstanceOnly,Category=MotionSubtitles)
	TObjectPtr<UStaticMeshComponent> SpritePlane;

	UPROPERTY(VisibleAnywhere,Category=MotionSubtitles)
	TObjectPtr<UMaterial> SpriteMaterial;

	UPROPERTY(VisibleAnywhere,Category=MotionSubtitles)
	TObjectPtr<UMaterialInstanceDynamic> MaterialInst;
};
